import React from 'react'

import Select from './PickerBtnHoc'
import './Pickers.css'

class Btn extends React.Component {
    state = {
        selectTypeNowOption: '全部类型',
        selectTypeOptions: [
            { text: '全部类型' },
            { text: '美食' },
            { text: '送药上门' },
            { text: '饮料' },
            { text: '果蔬' },
        ],

    };
    //修改选项后更新显示
    upnowOption = (val) => {
        // console.log(222222222222);
        const { changeSelect } = this.props
        return () => {
            // console.log(111);
            let tetx = val.text
            this.setState({
                selectTypeNowOption: tetx
            })
            console.log('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!!!')
            changeSelect('sort_type_name', tetx)()
        }
    }


    render() {
        let { selectTypeNowOption, selectTypeOptions, selectCountOptions } = this.state
        let { changeSelect, selectNowCount } = this.props
        return (
            <div className='select-item'>

                <Select upnowOption={this.upnowOption} arrs={selectTypeOptions} title={selectTypeNowOption}></Select>
                <div className={selectNowCount ? 'selected btnIcon' : 'btnIcon'} onClick={changeSelect('count', '')}>筛选满减</div>

            </div>
        );
    }
}

export default Btn